#pragma once
#include "libglew/glew.h"
#ifdef WIN32
#include <GL/glut.h>
#endif
#ifdef __APPLE__
#include <GLUT/glut.h>
#define MAC_TIGER
#endif
#include "FCollada.h"
#include "FCDocument/FCDocument.h"
#include "FCDocument/FCDAsset.h"
#include "FCDocument/FCDLibrary.h"
#include "FCDocument/FCDGeometry.h"
#include "FCDocument/FCDGeometryMesh.h"
#include "FCDocument/FCDGeometryPolygons.h"
#include "FCDocument/FCDGeometryPolygonsTools.h"
#include "FCDocument/FCDGeometrySource.h"
#include "FUtils/FUFileManager.h"
#include "Triangle.h"
#include "Vector3.h"
#include "Vector4.h"
#include "Matrix4x4.h"
#include "ConfigSingleton.h"
#include "VBOProxySingleton.h"

namespace lib3dw
{
	typedef std::vector<Vertex> VertexVector;
	
	class ColladaGeometry
	{
		// Allow a model to access certain ColladaGeometry members
		friend class ColladaModel;
		
		public:
			ColladaGeometry(FCDocument* colladaDocument);
			~ColladaGeometry();
			const unsigned short GetTriangleCount();
			Triangle* GetTriangle(unsigned short index) const;
		
		protected:
			unsigned short triangleCount;
			unsigned short vertexCount;
			Triangle* triangles;
			GLuint vboId;
			GLuint displayList;

		private:
			Vector4* rotationVector;
			Vector3* scaleVector;
			Vector3* translationVector;
		
			void InitVBO();
			void BuildDisplayList();
			void ProcessGeometryLibrary(FCDGeometryLibrary* library);
			void ProcessMesh(FCDGeometryMesh* mesh);
			void ProcessVertexPositions(FCDGeometryPolygons* polygonGroup);
			void ProcessVertexNormals(FCDGeometryPolygons* polygonGroup);
			void ProcessTextureCoordinates(FCDGeometryPolygons* polygonGroup);
	};
}